package com.dark;

import static com.google.common.base.Preconditions.*;


/**
 * Created by tengxue on 16-6-13.
 * 前置条件判断方法.可以使用静态导入.
 */
public class PreconditionsDemo {



    public static void main(String[] args){
//        int i=1;
        //检查参数是否符合条件
//        checkArgument(i>2,"the params is invalidate!");

        //非空校验
//        String x=null;
        Student student=null;
//        checkNotNull(x,"the params is null");
        student=checkNotNull(student,"the params is null");
        System.out.println(student);

    }


    static class Student{
        private String name;
        private String grade;
        private String className;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getGrade() {
            return grade;
        }

        public void setGrade(String grade) {
            this.grade = grade;
        }

        public String getClassName() {
            return className;
        }

        public void setClassName(String className) {
            this.className = className;
        }

        @Override
        public String toString() {
            return "Student{" +
                    "name='" + name + '\'' +
                    ", grade='" + grade + '\'' +
                    ", className='" + className + '\'' +
                    '}';
        }
    }


}
